<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Users_model extends CI_Model {
	/**
	 * Global WHERE conditions for USER table
	 *
	 * @var array
	 * @access public
	 */
	var $global_where_conditions = array ();
	
	function __construct() {
        parent::__construct();
		
		$this->global_where_conditions = array (
			"ISACTIVE" => TRUE,
			"DELETED" => FALSE,
		);
    }
	
	/**
	 * get all user's datas
	 * 
	 * @access	public
	 * @param	void
	 * @return	array
	 */
	public function get_all() {
		$query = $this->db->get_where("USERS",$this->global_where_conditions);
		
		return $query->result();
	}
	
	/**
	 * get the specific user's datas
	 * 
	 * @access	public
	 * @param	int
	 * @return	array
	 */
	public function get($id) {
		$where_condition=array( "ID" => $id );
		$where_condition=array_merge($this->global_where_conditions,$where_condition);
		$query = $this->db->get_where("USERS",$where_condition);
		var_dump($where_condition);
		return $query->result();
	}
}

/* End of file users_model.php */
/* Location: ./application/models/users_model.php */